package web.member;

import services.MemberServices;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delMember")
public class DelMember extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json");
        int member_id = Integer.parseInt(req.getParameter("member_id"));
        String member_state = req.getParameter("member_state");
        int n = new MemberServices().delMember(member_id,member_state);
        String state = "启用".equals(member_state) ? "回复权限" : "禁用";
        resp.getWriter().println(n > 0 ? state + "成功" : state + "失败");
    }
}
